package com.example.library.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class UserController {

    @GetMapping("/login")
    public String login() {
        return "login";
    }

    @PostMapping("/users/login")
    public String doLogin(@RequestParam String username, @RequestParam String password, Model model) {
        // 假设登录成功
        return "redirect:/seats";
    }

    @GetMapping("/register")
    public String register() {
        return "register";
    }

    @PostMapping("/users/register")
    public String doRegister() {
        // 假设注册成功
        return "redirect:/login";
    }
}